/**
 * This file is part of 1genia trampoline
 * Copyright (C) 2007 1genia (contact@1genia.com)
 *
 * This library is free software; you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as
 * published by the Free Software Foundation; version 3 of the License. 
 *
 * This library is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Library General Public License for more details. 
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; see the file COPYING.TXT.  If not,
 * write to the Free Software Foundation, Inc., 51 Franklin Street,
 * Fifth Floor, Boston, MA 02110-1301, USA. 
 **/
package com.genia.toolbox.portlet.editor.gui;

import com.genia.toolbox.basics.editor.gui.AbstractGUI;
import com.genia.toolbox.portlet.editor.PortletEditorController;
import com.genia.toolbox.portlet.editor.gui.dialog.PortletCreationDialog;
import com.genia.toolbox.portlet.editor.gui.dialog.SubPortletCreationDialog;
import com.genia.toolbox.portlet.editor.gui.view.internal.PortletDocumentsDesktop;
import com.genia.toolbox.portlet.editor.gui.view.settings.MainSettingsPanel;
import com.genia.toolbox.portlet.editor.model.bean.PortletInitialSettings;
import com.genia.toolbox.portlet.editor.model.document.impl.DocumentModel;
import com.genia.toolbox.portlet.editor.model.portlet.impl.PortletModel;

/**
 * Main portlet editor GUI frame.
 */
@SuppressWarnings("serial")
public class PortletEditorGUI
    extends AbstractGUI<PortletDocumentsDesktop, MainSettingsPanel, PortletEditorController, DocumentModel, PortletModel, PortletInitialSettings>
{

  /**
   * Constructor.
   */
  public PortletEditorGUI()
  {
    super();
  }



  /**
   * Create the menubar.
   * 
   * @return the menubar.
   */
  @Override
  public PortletEditorMenuBar createMenuBar()
  {
    PortletEditorMenuBar menubar = new PortletEditorMenuBar(this);
    menubar.initialise();
    return menubar;
  }



  /**
   * Create the toolbar.
   * 
   * @return the toolbar.
   */
  @Override
  public PortletEditorToolBar createToolBar()
  {
    PortletEditorToolBar toolbar = new PortletEditorToolBar(this);
    toolbar.initialise();
    return toolbar;
  }



  /**
   * Create the desktop panel.
   * 
   * @return the desktop panel.
   */
  @Override
  public PortletDocumentsDesktop createDesktopPanel()
  {
    return new PortletDocumentsDesktop(this);
  }



  /**
   * Create the settings panel.
   * 
   * @return the settings panel.
   */
  @Override
  public MainSettingsPanel createSettingsPanel()
  {
    return new MainSettingsPanel(this);
  }



  /**
   * Create a new document.
   * 
   * @return the initial settings.
   */
  @Override
  public PortletInitialSettings createElement()
  {
    PortletCreationDialog dialog = new PortletCreationDialog(this);
    dialog.initialise();
    dialog.setVisible(true);
    return dialog.getSettings();
  }



  /**
   * Create a new sub-portlet.
   * 
   * @return the initial settings.
   */
  @Override
  public PortletInitialSettings createSubElement()
  {
    SubPortletCreationDialog dialog = new SubPortletCreationDialog(this);
    dialog.initialise();
    dialog.setVisible(true);
    return dialog.getSettings();
  }

}
